home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 2 / AACD 2.iso / AACD / Magazine / GraphicsCards / StormMesa / src-glut / glut_stroke.c < prev    next >
C/C++ Source or Header  |  1998-12-15  |  983b  |  43 lines

  1.  
  2. /* Copyright (c) Mark J. Kilgard, 1994. */
  3.  
  4. /* This program is freely distributable without licensing fees
  5.    and is provided without guarantee or warrantee expressed or
  6.    implied. This program is -not- in the public domain. */
  7.  
  8. #include "glutint.h"
  9. #include "glutstroke.h"
  10.  
  11. void APIENTRY 
  12. glutStrokeCharacter(GLUTstrokeFont font, int c)
  13. {
  14.   const StrokeCharRec *ch;
  15.   const StrokeRec *stroke;
  16.   const CoordRec *coord;
  17.   StrokeFontPtr fontinfo;
  18.   int i, j;
  19.  
  20.  
  21. #if defined(_WIN32)
  22.   fontinfo = (StrokeFontPtr) __glutFont(font);
  23. #else
  24.   fontinfo = (StrokeFontPtr) font;
  25. #endif
  26.  
  27.   if (c < 0 || c >= fontinfo->num_chars)
  28.     return;
  29.   ch = &(fontinfo->ch[c]);
  30.   if (ch) {
  31.     for (i = ch->num_strokes, stroke = ch->stroke;
  32.       i > 0; i--, stroke++) {
  33.       glBegin(GL_LINE_STRIP);
  34.       for (j = stroke->num_coords, coord = stroke->coord;
  35.         j > 0; j--, coord++) {
  36.         glVertex2f(coord->x, coord->y);
  37.       }
  38.       glEnd();
  39.     }
  40.     glTranslatef(ch->right, 0.0, 0.0);
  41.   }
  42. }
  43.